<template>
  <div class="app-container">
    <el-form :inline="true" class="demo-form-inline">
        <el-form-item label="队列名">
        <el-input v-model="listQuery.mqName" />
      </el-form-item>
       <el-button type="primary" @click="getList(1)">搜索</el-button>
      </el-form>
    <mytable :data="list" ref="table" @getList="getList" :listQuery="listQuery">
      <el-table-column prop="createTime" align="center" label="创建时间" width="200px"></el-table-column>
       <el-table-column prop="mqName" align="center" label="队列名" width="200px"></el-table-column>
      <el-table-column prop="msg" align="center" label="日志内容"></el-table-column>

      <el-table-column align="center" label="操作" width="200px">
        <template slot-scope="scope">
          <el-button type="primary" size="small"  @click.native="redo(scope.row.id)">重发</el-button>
          <el-button type="danger" size="small" @click.native="del(scope.row.id)">删除</el-button>
        </template>
      </el-table-column>
    </mytable>
  </div>
</template>

<script>
import apitrapLog from "@/api/logManage/trapLog";
import mytable from "@/components/Table";
import {confirm} from '@/utils/index'
export default {
  name: "mqOmission",
  components: { mytable },
  data() {
    return {
      list: [],
      listQuery: {
        mqName:"",//队列名
      },
       listLoading: true
    };
  },
  created() {
    this.getList();
  },
  methods: {
    getList(pageNo) {
       this.listQuery.pageNo = pageNo || this.listQuery.pageNo;
      apitrapLog.query(this.listQuery).then(res => {
        this.$refs.table.load(res.data.page.list, res.data.page.total);
      });
    },
    redo(id){
      confirm('是否确认重发？').then(res=>{
        apitrapLog.redo(id).then(res=>{
          this.getList();
          this.$message({ showClose: true, message: '发送成功', type: 'success' });  
        })
      })
    },
    del(id){
      confirm('是否确认删除？').then(res=>{
        apitrapLog.del(id).then(res=>{
          this.getList();
          this.$message({ showClose: true, message: '删除成功', type: 'success' });  
        })
      })
    }
  }
};
</script>

<style scoped>
</style>